package com.moonlit.myspring;

import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.util.List;
import java.util.Map;

/**
 * Created by Emou on 2021/1/18
 */
public class MoonLightPoet {
    private String name;
    private int age;
    private Poem poem;
    private List<String> list;
    private Map<String, String> map;

    public Poem getPoem() {
        return poem;
    }

    public void setPoem(Poem poem) {
        this.poem = poem;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public List<String> getList() {
        return list;
    }

    public void setList(List<String> list) {
        this.list = list;
    }

    public Map<String, String> getMap() {
        return map;
    }

    public void setMap(Map<String, String> map) {
        this.map = map;
    }

    public void perform() {
        System.out.println("name"+name);
        System.out.println("age" + age);
        poem.recite();
        for (String val : list) {
            System.out.println("list"+val);
        }
        for (Map.Entry<String, String> entry : map.entrySet()) {
            System.out.println("map"+entry.getKey()+"----"+entry.getValue());
        }
    }

    public static void main(String[] args) {
        ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("spring-idol.xml");
        MoonLightPoet moonlightPoet = (MoonLightPoet) context.getBean("moonlightPoet");
        moonlightPoet.perform();
    }
}
